package com.course.model.exception;

/**
 * @PROJECT_NAME: course
 * @DESCRIPTION: 业务自定义异常
 * @Author: 涂玄武
 * @DATE: 2021/4/25 9:30
 */
public class BusinessException extends RuntimeException {

    private BusinessExceptionCode code;

    public BusinessException(BusinessExceptionCode code) {
        super(code.getDesc());
        this.code = code;
    }

    public BusinessExceptionCode getCode() {
        return code;
    }

    public void setCode(BusinessExceptionCode code) {
        this.code = code;
    }

    /**
     * 不写入堆栈信息，提高性能
     *
     * @return
     */
    public Throwable fillInStackTrace() {
        return this;
    }
}
